-include_lib("ect/include/ect.hrl").
-class(equality_pattern).

?FIELDS(1,private,{a={3,a,hejehuja}}).
?FIELDS(1,private,{b=krumpli}).
?FIELDS(1,private,{c=krumpli}).
?FIELDS(1,private,{d="hello"++[0.7,krumpli]}).

-export([dotest/0]).

dotest() ->
    test( #equality_pattern{c = kakukktojas} ).

test(EP = #equality_pattern{a = T={Pos,_,_},c = kakukktojas}) when element(Pos,T) =:= hejehuja ->
    test(EP#equality_pattern{a = setelement(Pos,T,pass)});
test(#equality_pattern{a =T={Pos,_,_}, b = A, d = [$h,$e,$l,$l,$o,0.7,A]}) ->
    if A=:=krumpli ->
        element(Pos, T)
    end.